import { hasPerm, PermissionName } from '@/config/acl'
import { getDocById } from '@/api/doc'

export function access (docId: number, ...names: PermissionName[]): Promise<boolean> {
  return getDocById(docId).then(data => {
    return names.every(name => hasPerm(name, data))
  })
}
